#import "@{nameOfClass}.h"
@{importChildHs}
@implementation @{nameOfClass}
@synthesize @{id} = _@{id};
@synthesize parentController = _parentController;
@synthesize currentContainer = _currentContainer;
@synthesize contextDictionary = _contextDictionary;
@synthesize viewObject = _viewObject;
@{addChildSynthesizes}
@{controllerC};
@{context};

- (id)initWithParentCtl:(UIViewController*) parentCtl
{
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
        if(parentCtl){
            self.parentController = parentCtl;
        }else{
            self.parentController = self;
        }
        _viewObject = [[UMLayoutView alloc] init];
        _@{id} = self.viewObject;
        self.view = self.viewObject.view;
        @{selfView}
        [self viewDidLoad];
    }
	return self;
}
- (void)loadView
{
	[super loadView];
}

- (void)viewDidLoad
{
	[super viewDidLoad];
	AppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
	_currentContainer = [appDelegate currentContainer];
	[_currentContainer initController:ModelName];

	chartView = [[UMPChartView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) dataSource:self];
	[self.view addSubview:chartView];

	@{initChilds}
	@{addChilds}

	@{setviewDidLoads}
}
-(NSArray *)UMPChartView:(UMPChartView *)chartView ChartControl:(UFChartControl *)control{
    //设置数据源
    NSMutableArray * data = [[NSMutableArray alloc] init];

	   //给Series添加一些数据点。
    NSArray *arguments1 = [NSArray arrayWithObjects:@"华北", @"华南",@"华东", @"华西",@"华中", @"东北",@"西北", @"东南", @"西南", nil];
    NSArray *values1 = [NSArray arrayWithObjects:@"10", @"-90",@"-12", @"57",@"87", @"-48",@"29",@"10", @"-90", nil];
    
    ChartData * chart = [[ChartData alloc] init];
    chart.seriseName = @"销售金额";
    chart.keyArr = arguments1;
    chart.valueArr = values1;
    @{UMPChartViewDelegate}
    [data addObject:chart];
	return data;
}
- (void)viewWillAppear:(BOOL)animated
{
	[super viewWillAppear:animated];
	[SysContext getInstance].CurrentViewController = self;
}
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
        AppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
    NSString* result_str = [appDelegate.plugDict objectForKey:@"result"];
    if(result_str){
        [self dataBind:result_str];
    }

    [SysContext getInstance].CurrentViewController = self;
    @{onload}
}
- (void)viewDidUnload
{
	[super viewDidUnload];
}
- (void)dispacherEventToWebView:(NSString*)params
{
	[webView.m_jsBridge callHandler:@"eventdispacher" data:params];
	[_currentContainer DataBinding:self jsonData:params];
}
-(void)onInit{
    [_currentContainer onInit:controllerC];
}
-(void)onLoad{
    [_currentContainer onLoad:controllerC];
}
-(void)onDataBinding{
    //here do databinding
    NSString *context = [_currentContainer getModel:ModelName];
    _contextDictionary = [context objectFromJSONString];
    [self dataBind:_contextDictionary];
}
-(void)onComplete{
    [_currentContainer onComplete:controllerC];
    
    //common message: {"error":["网络无法连接！"],"warnning":[]}
    NSString *msg = [_currentContainer getMessage];
    //[self dumpMsg:msg];
    
}
- (void)dataBind:(NSDictionary*) dic{
	_contextDictionary = dic;
	@{dataBinds}
}
@{actions}
@end